import Vue from 'vue'
import { Message, MessageBox } from 'element-ui';//按需导入element-ui
import VueLazyload from 'vue-lazyload' //导入图片懒加载

import * as API from '@/api' //导入封装的组件发请求函数
import router from '@/router' //引入路由
import store from '@/store' //引入状态管理Vuex仓库
import noRepeatClick from '@/utils/noRepeatClick'

import App from './App.vue'
import TypeNav from '@/components/TypeNav' //引入TypeNavs三级导航组件
import lazyImg from "@/assets/lazy-img.png" //设置懒加载前图片

import '@/mock/mockServe.js' //引入mockjs模拟数据
import "swiper/css/swiper.css";//引入swiper轮播图样式
import 'default-passive-events'

Vue.prototype.$message = Message; //
Vue.prototype.$MessageBox = MessageBox;
Vue.prototype.$confirm = MessageBox.confirm;
Vue.prototype.$alert = MessageBox.alert;

Vue.use(VueLazyload, { loading: lazyImg, })//使用挂载懒加载前图片

//引入自定义防止重复点击弹窗noRepeatClick插件
Vue.use(noRepeatClick);

Vue.component(TypeNav.name, TypeNav) //注册为全局组件
Vue.config.productionTip = false  //关闭开发提示

Vue.prototype.$API = API //挂载API

new Vue({
  render: h => h(App),
  router,
  store,
  beforeCreate() {
    Vue.prototype.$eventBus = this  //创建全局事件总线$eventBus
  }
}).$mount('#app')

